<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>狮桥资本车辆交接验收单</title>
<jsp:include page="../../import.jsp" flush="true" />
<jsp:include page="../assParking/assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<form id="entryForm">
				<div class="fieldset1 tabel_col clearFix">
					<!-- 基本信息 -->
					<div class="caption">
						<span class="title"><strong>狮桥资本车辆交接验收单</strong></span>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">承租人</div>
						<div class="field">
							<span id="cstNm" name="cstNm">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
		                <div class="label">支付表号</div>
		                <div class="field">
		                    <span id="paySchNo_1" name="paySchNo_1">&nbsp;</span>
		                </div>
		            </div>
					<div class="fieldBox col_33">
						<div class="label">车架号</div>
						<div class="field">
							<span id="prdVin" name="prdVin">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">车辆品牌</div>
						<div class="field">
							<span id="brandNm" name="brandNm">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">车辆类型</div>
						<div class="field">
							<span id="prdType" name="prdType">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">车身颜色</div>
						<div class="field" style="width: 100%;">
							<input name="carCl" id="carCl" value="" type="text" class="ui-textbox" validate="{required:true}">
						    <span class="requiredSymbol">*</span>
						</div>
					</div>
		            <div class="fieldBox col_33 bsxx">
						<div class="label">车长(米)</div>
						<div class="field">
							<input name="carLen" id="carLen" value="" type="text" class="ui-textbox" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">表征里程</div>
						<div class="field">
							<input name="tokenMileage" id="tokenMileage" value="" type="text" class="ui-textbox" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
		            <div class="fieldBox col_33 bsxx">
		                <div class="label">车牌号</div>
		                <div class="field">
		                    <input name="plateNumber" id="plateNumber" value="" type="text" class="ui-textbox" validate="{required:true}">
		                    <span class="requiredSymbol">*</span>
		                </div>
		            </div>
		            <div class="fieldBox col_33">
						<div class="label">车辆所属省公司</div>
						<div class="field">
							<span id="provincialCompany" name="provincialCompany">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">保管城市</div>
						<div class="field">
							<span id="provinceCity" name="provinceCity">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">是否正常行驶</div>
						<div class="field">
							 <input type="radio" value="1" id="isRun1" name="isRun" />是
							 <input type="radio" value="0" id="isRun0" name="isRun" />否
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">行驶证</div>
						<div class="field">
							 <input type="radio" value="1" id="isLicense1" name="isLicense" />有
							 <input type="radio" value="0" id="isLicense0" name="isLicense" />无
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">营运证</div>
						<div class="field">
							 <input type="radio" value="1" id="isCertificate1" name="isCertificate"/>有
							 <input type="radio" value="0" id="isCertificate0" name="isCertificate"/>无
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">钥匙</div>
						<div class="field">
							 <input type="radio" value="1" id="isKey1" name="isKey"/>有
							 <input type="radio" value="0" id="isKey0" name="isKey"/>无
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">质保手册</div>
						<div class="field">
							 <input type="radio" value="1" id="isQuality1" name="isQuality"/>有
							 <input type="radio" value="0" id="isQuality0" name="isQuality"/>无
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_66_auto bsxx">
						<div class="label">交强险</div>
						<div class="field">
							 <input type="radio" value="1" id="isIns1" name="isIns"/>有
							 (至<input name="insDt" id="insDt" type="text" class="ui-datepicker" value="">&nbsp;)
							 <input type="radio" value="0" id="isIns0" name="isIns" />无
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">其他</div>
						<div class="field">
							<input name="otherRem" id="otherRem" value="" type="text" class="ui-textbox" >
						</div>
					</div>
					<div class="fieldBox col_66_auto bsxx">
						<div class="label">轮胎</div>
						<div class="field">
							应有<input name="tyreShouldQty" id="tyreShouldQty" value="" type="text" class="ui-textbox" ligerui="width: 50" validate="{required:true}">条,
							正常<input name="tyreNormalQty" id="tyreNormalQty" value="" type="text" class="ui-textbox" ligerui="width: 50" validate="{required:true}">条,
							损坏<input name="tyreDamageQty" id="tyreDamageQty" value="" type="text" class="ui-textbox" ligerui="width: 50" validate="{required:true}">条,
							缺失<input name="tyreDefectQty" id="tyreDefectQty" value="" type="text" class="ui-textbox" ligerui="width: 50" validate="{required:true}">条,
							备胎<input name="tyreSpareQty" id="tyreSpareQty" value="" type="text" class="ui-textbox" ligerui="width: 50"   validate="{required:true}">条
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33 bsxx">
						<div class="label">GPS编号</div>
						<div class="field">
							<input name="gpsCardNo" id="gpsCardNo" value="" type="text" class="ui-textbox" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_66_auto bsxx">
						<div class="label">车身重大损坏</div>
						<div class="field">
							 <input type="radio" value="1" id="isDamage1" name="isDamage"/>有
							  <input name="damageRem" id="damageRem" value="" type="text" class="ui-textbox" >
							 <input type="radio" value="0" id="isDamage0" name="isDamage"/>无
							 <span class="requiredSymbol">*</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">停车场名称</div>
						<div class="field">
							<span id="parkNm" name="parkNm">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_66_auto">
						<div class="label">停车场地址</div>
						<div class="field">
							<span id="parkAddress" name="parkAddress">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_50 bsxx">
						<div class="label">交车人签字</div>
						<div class="field">
							<input name="handoverNm" id="handoverNm" value="" type="text" class="ui-textbox" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_50 bsxx">
						<div class="label">接车人签字</div>
						<div class="field">
							<input name="receiverNm" id="receiverNm" value="" type="text" class="ui-textbox" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
		            <div class="fieldBox col_50 bsxx">
						<div class="label">交接日期</div>
						<div class="field">
							<input name="handoverDt" id="handoverDt" type="text" class="ui-datepicker" value="" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
		            <div class="fieldBox col_50 bsxx">
						<div class="label">交接日期</div>
						<div class="field">
							<input name="receiverDt" id="receiverDt" type="text" class="ui-datepicker" value="" validate="{required:true}">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
		            <div class="fieldBox col_100 bsxx">
						<div class="label">备注</div>
						<div class="field">
							<textarea name="handoverRem" id="handoverRem" rows="3" class="l-textarea" style="width:98%" value="" ></textarea>
						</div>
					</div>
					<!-- 完善信息 -->
					<div class="caption">
						<span class="title"><strong>狮桥资本车辆交接验收单-完善信息</strong></span>
					</div>
					<div class="fieldBox col_66_auto wswz wsxx">
						<div class="label"><span class="wz">&nbsp;&nbsp;违章</span></div>
						<div class="field">
							1分：<input name="illegalOne" id="illegalOne" value="" type="text" class="ui-textbox" ligerui="width: 50" onchange="updateOne()">
							2分：<input name="illegalTwo" id="illegalTwo" value="" type="text" class="ui-textbox" ligerui="width: 50" onchange="updateOne()">
							3分：<input name="illegalThree" id="illegalThree" value="" type="text" class="ui-textbox" ligerui="width: 50" onchange="updateOne()">
							6分：<input name="illegalSix" id="illegalSix" value="" type="text" class="ui-textbox" ligerui="width: 50" onchange="updateOne()">
							12分：<input name="illegalTwelve" id="illegalTwelve" value="" type="text" class="ui-textbox" ligerui="width: 50" onchange="updateOne()">
							总计分：<input name="illegalCount" id="illegalCount" value="" type="text" class="ui-textbox" ligerui="width: 50" readonly="readonly">
							<!-- 其他：<input name="illegalOther" id="illegalOther" value="" type="text" class="ui-textbox" ligerui="width: 160"> -->
						</div>
					</div>
					<div class="fieldBox col_33 wsgh wsxx">
						<div class="label"><span class="gh">&nbsp;&nbsp;是否过户</span></div>
						<div class="field">
							 <input type="radio" value="1" id="isTransfer1" name="isTransfer"/>是
							 <input type="radio" value="0" id="isTransfer0" name="isTransfer"/>否
						</div>
					</div>
					<div class="fieldBox col_66_auto wsxx">
						<div class="label">商业险</div>
						<div class="field">
							 <input type="radio" value="1" id="isCmIns1" name="isCmIns"/>有
							 (至<input name="cmInsDt" id="cmInsDt" type="text" class="ui-datepicker" value="">&nbsp;)
							 <input type="radio" value="0" id="isCmIns0" name="isCmIns"/>无
						</div>
					</div>
					<div class="fieldBox col_33 wssg wsxx">
						<div class="label"><span class="sg">&nbsp;&nbsp;有无重大事故</span></div>
						<div class="field">
							 <input type="radio" value="1" id="isAccident1" name="isAccident"/>有
							 <input type="radio" value="0" id="isAccident0" name="isAccident"/>无
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">排放标准</div>
						<div class="field">
							<input name="emiStd" id="emiStd" value="" type="text" class="ui-textbox" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">发动机品牌</div>
						<div class="field">
							<input name="engBrand" id="engBrand" value="" type="text" class="ui-textbox" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">发动机型号</div>
						<div class="field">
							<input name="engMdl" id="engMdl" value="" type="text" class="ui-textbox" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">发动机马力</div>
						<div class="field">
							<input name="hp" id="hp" value="" type="text" class="ui-textbox" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">桥</div>
						<div class="field">
							<input name="bridge" id="bridge" value="" type="text" class="ui-textbox">
						</div>
					</div>
		            <div class="fieldBox col_33 wsxx">
						<div class="label">出厂时间</div>
						<div class="field">
							<input name="playingDt" id="playingDt" type="text" class="ui-datepicker" value="" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">上牌时间</div>
						<div class="field">
							<input name="licDt" id="licDt" value="" type="text" class="ui-datepicker" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">车辆年审时间</div>
						<div class="field">
							<input name="carAnnualDt" id="carAnnualDt" value="" type="text" class="ui-datepicker" >
						</div>
					</div>
					<div class="fieldBox col_33 wsxx">
						<div class="label">营运证年审时间</div>
						<div class="field">
							<input name="certificateAnnualDt" id="certificateAnnualDt" value="" type="text" class="ui-datepicker" >
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">上装配置</div>
						<div class="field">
							<span id="boxDesc" name="boxDesc">&nbsp;</span>
						</div>
					</div>
					<!-- 隐藏支付表主键、支付表号 -->
	                <div class="fieldBox col_100" style="display:none;">
	                    <div class="field">
	                         <input name="tcMasterId" id="tcMasterId" type="text" class="ui-textbox" value="${tcMasterId}">
	                         <input name="tcDetailId" id="tcDetailId" type="text" class="ui-textbox" value="${tcDetailId}">
	                         <input name="paySchId" id="paySchId" type="text" class="ui-textbox" value="${paySchId}">
	                         <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="${paySchNo}">
                             <input name="wsPaySchId" id="wsPaySchId" type="text" class="ui-textbox" value="${wsPaySchId}">
                             <input name="wsPaySchNo" id="wsPaySchNo" type="text" class="ui-textbox" value="${wsPaySchNo}">
	                         <input name="prjId" id="prjId" type="text" class="ui-textbox" value="${prjId}">
	                         <input name="crflag" id="crflag" type="text" class="ui-textbox" value="${crflag}">
							 <input name="tcHvId" id="tcHvId" type="text" class="ui-textbox" value="${tcHvId}">
	                         <!-- 上传文件使用：系统时间和当前登录人姓名 -->
	                         <input name="delFlag" id="delFlag" type="text" class="ui-textbox" value="">
	                         <input name="sysDate" id="sysDate" type="text" class="ui-textbox" value="${sysDate }">
	                         <input name="loginUsrNm" id="loginUsrNm" type="text" class="ui-textbox" value="${loginUsrNm }">
						</div>
	                </div>
				</div>
				<div class="btnsBox sbtn1">
					<span id="saveAssEntryBtn" class="sq-button sq-button-round" onclick="saveAssEntry(1)">保存</span>
				</div>
				<div class="fieldset1 tabel_col clearFix">
					<!-- 上传附件 -->
					<div class="fieldBox col_100_auto fjsc">
						<div class="label">附件上传</div>
						<div class="field">
							<select name="attachmentType" id="attachmentType" ligerui="width: 80">
								<c:if test="${crflag == 'entry' }">
									<option value="1" selected>入库单</option>
									<option value="2">出库单</option>
								</c:if>
								<c:if test="${crflag == 'out' }">
									<option value="1">入库单</option>
									<option value="2" selected>出库单</option>
								</c:if>
		                    </select>
							<jsp:include page="../assCommFilesUpload.jsp" flush="true" >
								<jsp:param name="filePath" value="ass"/>
							</jsp:include>
							<div id="fileUpload1" class="upfileBoxs"></div>
							<span class="sq-button sq-button-hasicon" id="btnUpload1" onclick="ajaxFileUploadImg('uploads1',1)">
								<i class="sqBtnIco_9"></i>上传
							</span>
						</div>
					</div>
					<!-- 附件显示 -->
					<div class="fieldBox col_100 fjxs">
						<div style="width: 98%; margin-left: 1%;">
							<jsp:include page="../assCommFilesList.jsp" flush="true" ></jsp:include>
							<div id="ligergrid_file1" class="sq-grid"></div>
						</div>
					</div>
					<!-- 修改拖车申请信息备注 -->
		            <div class="fieldBox col_100 crkbz">
						<div class="label">备注</div>
						<div class="field">
							<textarea name="entryOutRem" id="entryOutRem" rows="3" class="l-textarea" style="width:98%" value="" ></textarea>
						</div>
					</div>
					<div class="tip2" style="text-align: center;line-height: 2.3em;">
						<font color="red">提示：请先点击上面“保存”按钮,保存“车辆交接验收单”.</font>
					</div>
				</div>
				<div class="btnsBox sbtn2">
					<span id="saveOutEntryBtn" class="sq-button sq-button-round" onclick="saveAssEntry(2)">保存出入库</span>
					<span id="closeBtn" class="sq-button sq-button-round" onclick="closeBtn()">关闭</span>
				</div>
			</form>
		</div>
	</div>

    <script>
        var _isUpload = 0;//是否上传了附件
        var _operateFlag = 0;//操作标识，用来标识是否保存了车辆交接验收单
	    $(function() {
	    	//$("#entryForm").ligerForm();//初始化表单
	    	initForm();
	        initData();//初始化数据
	        initHvData();//初始化数据
	    	//loadFilesLiger("crkzl", 1, $("#tcDetailId").val());//加载文件列表信息
	    });
	  	//初始化表单
	    function initForm(){
	    	$("#entryForm").ligerForm({
				validate: true
			});
		};
	    //初始化数据
	    function initData(){
	    	$("#entryForm").ligerForm({
				validate: true
			});
	    	var tcDetailId = $("#tcDetailId").val();
	    	if(!tcDetailId){
	    		return;
	    	}
	    	
	    	
	    	//var wait_dialog= $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_LOADING,SQ_type: "waitting"});
	    	
	    	var _url = '<%=path%>/ass/assTrailCarD/getTransferInfo.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{tcDetailId:tcDetailId},
	    		url: _url,
	    		success:function(msg){
	    			 //wait_dialog.close();
	    			 if(msg.success == 1){
	    				 setData(msg.data);//设置数据
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
	    }
	       //违章分数总计分
	    	function updateOne(){
	    		 var one = 0;//1分
	    		 one = document.getElementById("illegalOne").value;
	    		  var two = 0;//2分
	    		 two = document.getElementById("illegalTwo").value;
	    		 var three = 0;//3分
	    		 three = document.getElementById("illegalThree").value;
	    		 var six = 0;//6分
	    		 six = document.getElementById("illegalSix").value;
	    		 var twelve = 0;//12分
	    		 twelve = document.getElementById("illegalTwelve").value; 
	    		 //给总计分赋值
	    		 document.getElementById('illegalCount').value=1*one+2*two+3*three+6*six+12*twelve;
	    	}
	    //设置页面数据
	    function setData(data){
	    	//设置基本信息显示
 	    	$("#cstNm").html(data.cstNm);
 	    	$("#paySchNo_1").html($("#wsPaySchNo").val());
 	    	$("#prdVin").html(data.prdVin);//车架号
 	    	$("#brandNm").html(data.brandNm);//品牌
 	    	$("#prdType").html(data.prdType);//车辆类型
 	    	$("#provincialCompany").html(data.provincialCompany);//省公司
 	    	$("#provinceCity").html(data.provinceCd + "--" + data.cityCd);
 	    	$("#parkNm").html(data.parkNm);//停车场
 	    	$("#parkAddress").html(data.parkAddress);//地址
 	    	
 	    	$("#illegalCount").html(1*one+2*two+3*three+6*six+12*twelve);//总计分
 	    	//设置出入库备注
 	    	var crflag = $("#crflag").val();
			if(crflag == "entry"){
				if(null != data.enterRem){
					$("#entryOutRem").val(data.enterRem);
				}
			}else if(crflag == "out"){
				if(null != data.outRem){
					$("#entryOutRem").val(data.outRem);
				}
			}else{
				if(null != data.enterRem && null != data.outRem){
					$("#entryOutRem").val(data.enterRem + data.outRem);
				}else if(null != data.enterRem && null == data.outRem){
					$("#entryOutRem").val(data.enterRem);
				}else if(null == data.enterRem && null != data.outRem){
					$("#entryOutRem").val(data.outRem);
				}
			}
	    }
	    
	    //初始化数据
	    function initHvData(){
	    	var tcDetailId = $("#tcDetailId").val();
	    	if(!tcDetailId){
	    		return;
	    	}
	    	//var wait_dialog= $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_LOADING,SQ_type: "waitting"});
	    	
	    	var _url = '<%=path%>/ass/assTrailCarM/getHvInfoByDetailId.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{tcDetailId:tcDetailId},
	    		url: _url,
	    		success:function(msg){
	    			 //wait_dialog.close();
	    			 if(msg.success == 1){
	    				 setHvData(msg.data);//设置数据
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
	    }
	    
	  	//设置页面数据
	    function setHvData(data){
	    	//加载表单
	    	var form = liger.get("entryForm");
			form.setData({
				carCl: data.carCl,
				carLen: data.carLen,
				tokenMileage: data.tokenMileage,
				plateNumber: data.plateNumber,
				isRun: setRadioVal("isRun", data.isRun),
				isLicense: setRadioVal("isLicense", data.isLicense),
				isCertificate: setRadioVal("isCertificate", data.isCertificate),
				isKey: setRadioVal("isKey", data.isKey),
				isQuality: setRadioVal("isQuality", data.isQuality),
				isIns: setRadioVal("isIns", data.isIns),
				insDt: renderDate1(data.insDt),
				otherRem: data.otherRem,
				tyreShouldQty: data.tyreShouldQty,
				tyreNormalQty: data.tyreNormalQty,
				tyreDamageQty: data.tyreDamageQty,
				tyreDefectQty: data.tyreDefectQty,
				tyreSpareQty: data.tyreSpareQty,
				gpsCardNo: data.gpsCardNo,
				isDamage: setRadioVal("isDamage", data.isDamage),
				damageRem: data.damageRem,
				handoverNm: data.handoverNm,
				receiverNm: data.receiverNm,
				handoverDt: renderDate1(data.handoverDt),
				receiverDt: renderDate1(data.receiverDt),
				handoverRem: data.handoverRem,
				illegalOne: data.illegalOne,
				illegalTwo: data.illegalTwo,
				illegalThree: data.illegalThree,
				illegalSix: data.illegalSix,
				illegalTwelve: data.illegalTwelve,
				illegalCount:data.illegalCount,
				//illegalOther: data.illegalOther,
				isTransfer: setRadioVal("isTransfer", data.isTransfer),
				isCmIns: setRadioVal("isCmIns", data.isCmIns),
				cmInsDt: renderDate1(data.cmInsDt),
				isAccident: setRadioVal("isAccident", data.isAccident),
				emiStd: data.emiStd,
				engBrand: data.engBrand,
				engMdl: data.engMdl,
				hp: data.hp,
				bridge: data.bridge,
				playingDt: renderDate1(data.playingDt),
				licDt: renderDate1(data.licDt),
				carAnnualDt: renderDate1(data.carAnnualDt),
				certificateAnnualDt: renderDate1(data.certificateAnnualDt),
				tcHvId: data.id
	    	});
			$("#boxDesc").html(data.boxDesc);
	        showOrEdit();//设置显示-编辑属性
	  	}
	    
		//保存文件
		function saveFile(info,tcHvId){
			var flag = "rkd";//默认入库单
			var crflag = $("#crflag").val();
			if(crflag == "out"){
				flag = "ckd";//出库单
			}
			var docArray = JSON.stringify(getUploadResultParams(1));
	        var url = "<%=path%>/ass/assTrailCarD/uploadAttchment.do";
	        var tcDetailId = $("#tcDetailId").val();
        	if(null == docArray){
        		$.ligerDialog.SQalert({content: info,SQ_type: "success"});
        		return false;
        	}else{
		        if(tcDetailId){//拖车明细表ID不为空执行
			        //赋值附件
			        var data = {
						"docArray":docArray,
						"pkId": tcDetailId,
						"flag": flag
					};
					//请求
			        AjaxUtils.ajaxPost(url, data, function(msg){
			        	if(msg.success == 1){
			        		if(!$("#tcHvId").val() && info != null){//设置交接单ID
								$("#tcHvId").val(tcHvId);
							}
			        		//刷新附件页面GRID方法和清空上传按钮
			        		refreshUlFileRecList(1);
			        		clearUploadResultParams(1);
							top.$.ligerDialog.SQalert({content: info,SQ_type: "success"});
						 }else{
							 UIUtils.alertError(msg.info);
						 }
			        }, true);
		        }else{
		        	$.ligerDialog.SQalert({content: "业务主键为空-不能保存文件！",SQ_type: "error"});
		        }
        	}
		}
		
		//显示已上传但是未保存的文件列表
		function showFiles(data, index){
			var sysDate = $("#sysDate").val();
			var f_Grid = liger.get("ligergrid_file"+index);
			var fileRem = "入库单";//默认入库单
			var crflag = $("#crflag").val();
			if(crflag == "out"){
				fileRem = "出库单";//出库单
			}
			var uploadJOSN = data;
    		for (var i=0; i< uploadJOSN.length; i++){
        		//添加行-追加行
        		f_Grid.addRow({fileRem: fileRem, fileNm: uploadJOSN[i].fileNm, crtTm: sysDate, audStsCd: "未验证", doSthFlag: "1", ligerIndex: index,id:i});
    		}
    		
    		if(fileRem == "入库单"){
    			_isUpload = 1;//选择了入库单附件
    		}
		}
		//保存车辆交接单信息
		function saveAssEntry(sflag){
			var ligerForm = liger.get("entryForm");
			//获取车辆交接单表ID
			var tcHvId = $("#tcHvId").val();
			//判断信息填写情况
			if(sflag == 1 && $("#crflag").val() == "entry"){//资产管理员入库节点
				var isRunLen = $(':radio[name=isRun]:checked').length;//是否正常行驶
				var isLicenseLen = $(':radio[name=isLicense]:checked').length;//行驶证
				var isCertificateLen = $(':radio[name=isCertificate]:checked').length;//营运证
				var isKeyLen = $(':radio[name=isKey]:checked').length;//钥匙
				var isQualityLen = $(':radio[name=isQuality]:checked').length;//质保手册
				var isInsLen = $(':radio[name=isIns]:checked').length;//交强险
				var isDamageLen = $(':radio[name=isDamage]:checked').length;//车身重大损坏
				var isIns = $('input:radio[name="isIns"]:checked').val();//交强险的值
				var isDamage = $('input:radio[name="isDamage"]:checked').val();//车身重大损坏的值
				if(isIns == 1 && $("#insDt").val() == ""){
					top.$.ligerDialog.SQalert({content: "需填写交强险的描述信息",SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
				if(isDamage == 1 &&  $("#damageRem").val() == ""){
					top.$.ligerDialog.SQalert({content: "需填写车身重大损坏的描述信息",SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
				if (!ligerForm.valid() || isRunLen == 0 || isLicenseLen == 0 || isCertificateLen == 0 || isKeyLen == 0 || isQualityLen == 0 || isInsLen == 0 || isDamageLen == 0) {
					top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
			}
			if(sflag == 2){
				if(!tcHvId){//_operateFlag != 1
					top.$.ligerDialog.SQalert({content: "请先保存车辆交接验收单",SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
				if(_isUpload != 1 && $("#crflag").val() == "entry"){
					top.$.ligerDialog.SQalert({content: "请上传附件",SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
			}
			
			
			var crflag = $("#crflag").val();
			if(crflag == "modify1"){//转优车申请
				var isTransfer = $('.wsgh input[name="isTransfer"]:checked').val();
				var isAccident = $('.wssg input[name="isAccident"]:checked').val();
				//验证过户和事故情况
				if(isTransfer == "undefined" || isAccident == "undefined"){
					$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
					return false;
				}
				//验证违章信息文本框
				var list = $(".wswz").find('input[type=text]');
		        for (var i=0; i< list.length; i++){ 
		        	if(list[i].id){ 
		        		var val = liger.get(list[i].id).getValue();
		        		if(!val){
		        			$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
		        			return false;
		        		}
		        	}
	            }
			}
			//获取表单数据
			var data = ligerForm.getData();
			var wait_dialog = null;
			var url = '';
			//不同情况设置不同的url
			if(sflag == "1"){
				if(!tcHvId){
					url = '<%=path%>/ass/assTrailCarM/addWarehouseInfo.do';
				}else{
					url = '<%=path%>/ass/assTrailCarM/modifyWarehouseInfo.do';
				}
			}else if(sflag == "2"){
				url = '<%=path%>/ass/assTrailCarD/modifyEORem.do';
			}else{
				$.ligerDialog.SQalert({content: "保存标识为空！无法保存！",SQ_type: "warning"});
				return false;
			}
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: url,
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						if(sflag == "1"){
							if(!tcHvId && msg.data != null){//设置交接单ID
								$("#tcHvId").val(msg.data);
							}
							_operateFlag = 1;//交接验收单成功保存标识
							top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
						}else if(sflag == "2"){
							saveFile(msg.info,tcHvId);//保存文件
						}
					}else{
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		
		//设置显示/编辑属性
		function showOrEdit(){
			var list = null;
	    	var crflag = $("#crflag").val();
			var tcHvId = $("#tcHvId").val();//获取车辆交接单表ID
			//是否显示红色提示字样
        	if(!tcHvId){//为空显示提示
        		$(".tip2").removeClass('Hide');
			}else{
				$(".tip2").addClass('Hide');
			}
			//根据标识设置相应的属性
			if(crflag == "entry"){//入库
				$("#entryForm").find(".wsxx").each(function (){
					//设置文本框
					list = $(this).find('input[type=text]');
			        for (var i=0; i< list.length; i++){ 
			        	if(list[i].id){ 
			        		liger.get(list[i].id).setDisabled(true);
			        	}
		            }
			      	//设置单选组
					$(this).find('input[type=radio]').each(function (){
						$(this).attr("disabled",true);
		            });
	        	});
				$(".fjsc").removeClass('Hide');
				$(".sbtn1").removeClass('Hide');
	        	$(".sbtn2").removeClass('Hide');
	        	//设置交接单附件可删除
				$("#delFlag").val("1");
			}else if(crflag == "out"){//出库
				//设置基本信息不可编辑
				$("#entryForm").find(".bsxx").each(function (){
					//设置文本框
					list = $(this).find('input[type=text]');
			        for (var i=0; i< list.length; i++){ 
			        	if(list[i].id){ 
			        		liger.get(list[i].id).setDisabled(true);
			        	}
		            }
			      	//设置单选组
					$(this).find('input[type=radio]').each(function (){
						$(this).attr("disabled",true);
		            });
	        	});
				//设置完善信息不可编辑
				$("#entryForm").find(".wsxx").each(function (){
					//设置文本框
					list = $(this).find('input[type=text]');
			        for (var i=0; i< list.length; i++){ 
			        	if(list[i].id){ 
			        		liger.get(list[i].id).setDisabled(true);
			        	}
		            }
			      	//设置单选组
					$(this).find('input[type=radio]').each(function (){
						$(this).attr("disabled",true);
		            });
	        	});
				$(".fjsc").removeClass('Hide');
	        	$(".sbtn1").addClass('Hide');
	        	$(".sbtn2").removeClass('Hide');
	        	$("#handoverRem").attr("disabled","disabled");
	        	//设置交接单附件可删除
				$("#delFlag").val("1");
			}else if(crflag == "detail" || crflag == "modify1" || crflag == "modify2"){//查看-修改
				//设置基本信息不可编辑
				$("#entryForm").find(".bsxx").each(function (){
					//设置文本框
					list = $(this).find('input[type=text]');
			        for (var i=0; i< list.length; i++){ 
			        	if(list[i].id){ 
			        		liger.get(list[i].id).setDisabled(true);
			        	}
		            }
			      	//设置单选组
					$(this).find('input[type=radio]').each(function (){
						$(this).attr("disabled",true);
		            });
	        	});
				//设置完善信息不可编辑
				if(crflag == "detail" || crflag == "modify1"){
					$("#entryForm").find(".wsxx").each(function (){
						//设置文本框
						list = $(this).find('input[type=text]');
				        for (var i=0; i< list.length; i++){ 
				        	if(list[i].id){ 
				        		liger.get(list[i].id).setDisabled(true);
				        	}
			            }
				      	//设置单选组
						$(this).find('input[type=radio]').each(function (){
							$(this).attr("disabled",true);
			            });
		        	});
					if(crflag == "modify1"){//转优车申请时需要填写违章等信息
						//设置文本框
						list = $(".wswz").find('input[type=text]');
				        for (var i=0; i< list.length; i++){ 
				        	if(list[i].id){ 
				        		liger.get(list[i].id).setEnabled(true);
				        	}
			            }
				      	//设置单选组
						$(".wsgh").find('input[type=radio]').each(function (){
							$(this).attr("disabled",false);
			            });
						$(".wssg").find('input[type=radio]').each(function (){
							$(this).attr("disabled",false);
			            });
						$(".fjxs").addClass('Hide');
			        	$(".crkbz").addClass('Hide');
			        	//设置必填提醒
			        	$(".wz").prepend('<span class="requiredSymbol">*</span>');
			        	$(".gh").prepend('<span class="requiredSymbol">*</span>');
			        	$(".sg").prepend('<span class="requiredSymbol">*</span>');
					}
				}else{//库管补充交接单
					//设置文本框
					list = $(".wswz").find('input[type=text]');
			        for (var i=0; i< list.length; i++){ 
			        	if(list[i].id){ 
			        		liger.get(list[i].id).setDisabled(true);
			        	}
		            }
			      	//设置单选组
					$(".wsgh").find('input[type=radio]').each(function (){
						$(this).attr("disabled",true);
		            });
					$(".wssg").find('input[type=radio]').each(function (){
						$(this).attr("disabled",true);
		            });
				}
				$(".fjsc").addClass('Hide');
				//保存交接单信息按钮-查看时不可用
				if(crflag == "detail"){
		        	$(".sbtn1").addClass('Hide');
				}
		        $(".sbtn2").addClass('Hide');
	        	$("#handoverRem").attr("disabled","disabled");
	        	$("#entryOutRem").attr("disabled","disabled");
			}
	        liger.get("attachmentType").setDisabled(true);
	      	//加载文件列表信息
	    	loadFilesLiger("crkzl", 1, $("#tcDetailId").val());
		}
		
		//设置单选组选中值
		function setRadioVal(radioNm, val){
			//获取单选按钮的兄弟元素a-实例化自动生成的-哈哈-模拟选中动作
			$('#'+radioNm+val).siblings('a').trigger('click');
		}
		
		//取消/关闭当前页签
		function closeBtn(){
			var TAB=top.mainApp.parentTab;
			var currentTabid=TAB.getSelectedTabItemID();
			top.tab.removeTabItem(currentTabid);
		}
    </script>
</body>
</html>